#include <string>
#include <vector>
#include <map>

using namespace std;

#include "topdbs.hpp"

void replace_out(string& sCommandText,std::map<string,string>& rowdata)
{
    printf("sCommandText1=[%s]\n",sCommandText.c_str());
    topdbs_sqlconvert(sCommandText,rowdata);
    printf("sCommandText2=[%s]\n",sCommandText.c_str());
}

int main()
{
    std::string sCommandText;
    std::map<string,string> rowdata;
    rowdata["name"] = "wanghm";
    rowdata["age"] = "18";
    rowdata["amount"] = "160.78";

    sCommandText = "select * from table_name where name ={%s:name} and age = {%d:age} and amount = {%f:amount} ";
    replace_out(sCommandText,rowdata);

    sCommandText="insert into table_name values ('abc',{%s:name},{%d:age},{%f:amount});";
    replace_out(sCommandText,rowdata);

    return 0;
}